package com.dfbz.设计模式.factory2;

public class FruitFactory extends AbstractFruitFactory {
    @Override
    public <T extends Fruit> T createFruit(Class<T> fruit) {

        try {
            T t = fruit.newInstance();

            return t;

        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }

        return null;
    }
}
